import Vue from "vue";

import VueRouter from 'vue-router'

// 引入路由
import Home from '../pages/Home'
import Login from '../pages/Login'

//引入二级路由
import News from '../pages/Home/News'
import Music from '../pages/Home/Music'
import Gams from '../pages/Home/Gams'


Vue.use(VueRouter)


export default new VueRouter({
    //在实例化路由器对象的配置中,书写路由表配置
    routes: [
        {
            path: '/Home',
            component: Home,
            children: [
                { path: 'News', component: News, name: 'News' },
                { path: 'Music/:id/:time?', component: Music, name: 'Music' },
                // 2.二级路由重定向-redirect方法
                // {path:'/',redirect:'/login'},

                //2.二级路由重定向-component方法
                // {path:'',component:Login}

                { path: 'Gams', component: Gams, name: 'gams' }
            ]
        },
        { path: '/Login', component: Login },

        //1. 路由重定向
        /* 通过路由规则的redirect属性，指定一个新的路由地址，可以很方便地设置路由的重定向 */
        // {path:'/',redirect:'/home/news'}
    ]
})